﻿using UnityEngine;
using System.Collections;

public class ApplicationText : MonoBehaviour {
	UILabel label;
	UnitData m_unit;

	void Start(){
		m_unit = transform.parent.GetComponent<ApplicationBtn> ().m_unit;
	
		label = gameObject.GetComponent<UILabel> ();
        if (transform.parent.GetComponent<ApplicationBtn>().paperType == PAPER_TYPE.APPLICATION_POLICE)
            label.text = string.Format("\n\n\n\n\n     " + xmlLoader.GetInstance().TextLoad(XML_INDEX.STAT_DEF, "Health") + " : {0}\n     "
                + xmlLoader.GetInstance().TextLoad(XML_INDEX.STAT_DEF, "Morale") + " : {1}\n     "
                + xmlLoader.GetInstance().TextLoad(XML_INDEX.STAT_DEF, "Speed") + " : {2}\n\n\n     " 
                + xmlLoader.GetInstance().TextLoad(XML_INDEX.STAT_DEF, "Accuracy") + " : {3}\n     "
                + xmlLoader.GetInstance().TextLoad(XML_INDEX.STAT_DEF, "Strength") + " : {4}\n\n\n\n",
                                        m_unit.iHP, m_unit.iMorale, m_unit.iSpeedStat, m_unit.iAccur
                                      , m_unit.iStrength);
        else
        {
            label.text = string.Format(": {0}\n: {1}\n: {2}\n\n: {3}\n: {4}",
                                        m_unit.iHP, m_unit.iMorale, m_unit.iSpeedStat, m_unit.iAccur, m_unit.iStrength);
            label.fontSize = 26;
            label.spacingY = 0;
            transform.localPosition = new Vector3(-9, -10.1f);
        }
		label.depth = transform.parent.GetComponent<UISprite> ().depth + 1;
	}

	void Update () {

	}
}
